
import { Typography, Modal, Space } from 'antd';
const { Title } = Typography;
import RichText from '@/components/RichText'
import styles from './style.less';
import UserBrief from '@/components/UserBrief'

const HistoryArticle = (props) => {
    const {
        historyData,
        onClose
    } = props

    if (historyData) {
        return <Modal
            visible={!!historyData}
            width="80%"
            closable
            onCancel={onClose}
            footer={null}
        >
            <div>
                <div>
                    <Title level={2}>{historyData?.data.name}</Title>
                    <div className={styles.historyInfo}>
                        <div>第 {historyData.docVersions} 版</div>
                        <Space size={4}>{historyData.createTime} 被 <UserBrief user={historyData.user}></UserBrief> 修改</Space>
                    </div>
                    {
                        historyData?.data?.abstractTitle &&
                        <div className={styles.abstractTitle}><p>摘要：{historyData?.data?.abstractTitle}</p></div>
                    }
                </div >
                <div className={styles.content}>
                    <RichText value={historyData?.data?.content?.text}>
                    </RichText>
                </div>
            </div >
        </Modal>
    }

    return (<></>)
}

export default HistoryArticle;